<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            background: url(../images/1.jpg) no-repeat center top;
        }
        
        img {
            width: 300px;
            height: 300px;
        }
        
        .banner {
            overflow: hidden;
        }
    </style>
</head>

<body>
    <div class="banner">
        <div>
            <img src="../images/1.jpg" alt="">
        </div>
        <div>
            <img src="../images/2.jpg" alt="">
        </div>
    </div>
    <script>
        var imgs = document.getElementsByTagName('img')
        for (var i = 0; i < imgs.length; i++) {
            imgs[i].onclick = function() {

                document.body.style.backgroundImage = 'url(' + this.src + ')'
            }
        }
    </script>
</body>

</html>